﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
using System.ServiceModel.Web;
using ApiPrototype.Handlers;
using ApiPrototype.Models;
using System.Security.Principal;

namespace ApiPrototype.APIs
{
    [ServiceContract]
    public class DienstenApi
    {
        [WebGet]
        public ApiResponse<List<DienstDto>> Get(iphlEntities ctx)
        {
            List<DienstDto> result = new List<DienstDto>();
            
            foreach (DIENST d in ctx.DIENST.Include("OPENINGSUUR").ToList())
            {
                result.Add(new DienstDto() { Dienst = d, Openingsuren = d.OPENINGSUUR });
            }
            
            return new ApiResponse<List<DienstDto>>(result);
        }
    }
}